local OVALE, Ovale = ...
local OvaleScripts = Ovale.OvaleScripts

do
	local name = "simulationcraft_priest_discipline_t17m_dmg"
	local desc = "[6.1] AttiMod Priest_Discipline_T17M_Dmg"
	local code = [[
# Based on SimulationCraft profile "Attilio Priest_Discipline Questing".
#	class=priest
#	spec=discipline
#	talents=3223232
#	glyphs=smite/holy_fire/inquisitor

Include(ovale_common)
Include(ovale_trinkets_mop)
Include(ovale_trinkets_wod)
Include(ovale_priest_spells)

AddCheckBox(opt_interrupt L(interrupt) default specialization=discipline)
AddCheckBox(opt_potion_intellect ItemName(draenic_intellect_potion) default specialization=discipline)

AddFunction DisciplineUsePotionIntellect
{
	if CheckBoxOn(opt_potion_intellect) and target.Classification(worldboss) Item(draenic_intellect_potion usable=1)
}

AddFunction DisciplineInterruptActions
{
	if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.IsInterruptible()
	{
		Spell(silence)
		if not target.Classification(worldboss)
		{
			Spell(arcane_torrent_mana)
			if target.InRange(quaking_palm) Spell(quaking_palm)
			Spell(war_stomp)
		}
	}
}

### Discipline icons.

AddIcon help=main 
{
    if not target.IsFriend()
    {
        DisciplineInterruptActions()
        if InCombat() and not BuffPresent(6788) Spell(power_word_shield)
        if Talent(power_word_solace_talent) Spell(power_word_solace)
        if InCombat() Spell(penance)
        if not target.DebuffPresent(shadow_word_pain_debuff) or target.DebuffRemaining(shadow_word_pain_debuff) < BaseDuration(shadow_word_pain_debuff) * 0.3 Spell(shadow_word_pain)
        Spell(smite)
    }
    else
    {
        if target.HealthPercent() <= 30 { Spell(power_word_shield) Spell(penance) Spell(flash_heal)}
    }
}

AddIcon help=target 
{
    AdvancedDistanceFromTarget()
}


### Required symbols
# arcane_torrent_mana
# berserking
# blood_fury_sp
# draenic_intellect_potion
# glyph_of_smite
# holy_fire
# holy_fire_debuff
# mindbender
# mindbender_talent
# penance
# power_infusion
# power_infusion_talent
# power_word_fortitude
# power_word_solace
# power_word_solace_debuff
# power_word_solace_talent
# quaking_palm
# shadow_word_pain
# shadow_word_pain_debuff
# shadowfiend
# silence
# smite
# war_stomp
]]
	OvaleScripts:RegisterScript("PRIEST", "discipline", name, desc, code, "script")
end
